package com.example.framework.base;

import android.os.Bundle;
import android.view.MenuItem;

import androidx.annotation.NonNull;

/**
 * @author:0.2℃
 * @date： 2022-04-04 20:17
 * @Description ：带返回键的基类
 */
public class BaseBackActivity extends BaseActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // 显示左上角返回键
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        // 清除阴影
        getSupportActionBar().setElevation(0);
    }

    @Override
    public boolean onOptionsItemSelected(@NonNull MenuItem item) {
        if (item.getItemId() == android.R.id.home) {
            finish();
        }
        return super.onOptionsItemSelected(item);
    }
}
